package cn.lena.weblog.service.impl;

import cn.lena.weblog.config.MD5Utils;
import cn.lena.weblog.dao.UserDao;
import cn.lena.weblog.domain.User;
import cn.lena.weblog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
	private UserDao userDao;

	@Override
	public User findUserMore(Integer userId) {
		return userDao.findUserMore(userId);
	}

	@Override
	public User login(Integer userId, String password) {
		return userDao.login(userId, MD5Utils.code(password));
	}

	@Override
	public int update(User user) {
		return userDao.update(user);
	}

	@Override
	public User findByUserId(Integer userId) {
		return userDao.findByUserId(userId);
	}

	@Override
	public int findPassword(Integer userId, String password) {
		return userDao.findPassword(userId,MD5Utils.code(password));
	}

	@Override
	public int changePassage(Integer userId, String password) {
		return userDao.changePassage(userId,MD5Utils.code(password));
	}


}
